
<!DOCTYPE html>
<html class="no-js" lang="zh-CN">
    <head>
        <meta charset="utf-8"/>
        <title>微信支付</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <script src="__PUBLIC__/js/jquery.js"></script>

        <style>
            .motify{display:none;position:fixed;top:35%;left:50%;width:220px;padding:0;margin:0 0 0 -110px;z-index:9999;background:rgba(0, 0, 0, 0.8);color:#fff;font-size:14px;line-height:1.5em;border-radius:6px;-webkit-box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2);@-webkit-animation-duration 0.15s;@-moz-animation-duration 0.15s;@-ms-animation-duration 0.15s;@-o-animation-duration 0.15s;@animation-duration 0.15s;@-webkit-animation-fill-mode both;@-moz-animation-fill-mode both;@-ms-animation-fill-mode both;@-o-animation-fill-mode both;@animation-fill-mode both;}
            .motify .motify-inner{padding:10px 10px;text-align:center;word-wrap:break-word;}
            .motify p{margin:0 0 5px;}.motify p:last-of-type{margin-bottom:0;}
        </style>
    </head>
    <body>

       
         
                <script type="text/javascript">
                    callpay();
                    var order_no = "{$order_no}";
                    var jsApiParameters = <?php echo $jsApiParameters;?> ; //注意php格式不能错，不能有间隔
                            function jsApiCall() {
                                WeixinJSBridge.invoke('getBrandWCPayRequest', jsApiParameters, function(res) {
                                    var msg = res.err_msg;
    
                                    if (msg == "get_brand_wcpay_request:ok") {
                                        location.href = "__APP__/Pay/order_detail/order_no/" + order_no;
                                    } else {
                                        if (msg == "get_brand_wcpay_request:cancel") {
                                            var err_msg = "您取消了微信支付";
                                        } else if (res.err_code == 3) {
                                            var err_msg = "您正在进行跨号支付<br/>正在为您转入扫码支付......";
                                        } else if (msg == "get_brand_wcpay_request:fail") {
                                            var err_msg = "微信支付失败<br/>错误信息：" + res.err_desc;
                                        } else {
                                                          alert(res.err_code + res.err_desc + msg);
//                                            var err_msg = msg + "<br/>" + res.err_desc;
                                        }
                                        show_notice(err_msg);
                                    }
                
                                }
                                );
                            }

                    function callpay() {
                        if (typeof WeixinJSBridge == "undefined") {
                            if (document.addEventListener) {
                                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                            } else if (document.attachEvent) {
                                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                            }
                        } else {
                            jsApiCall();
                        }
                    }


                    window.onload = function() {
                        if (typeof WeixinJSBridge == "undefined") {
                            if (document.addEventListener) {
                                document.addEventListener('WeixinJSBridgeReady', '', false);
                            } else if (document.attachEvent) {
                                document.attachEvent('WeixinJSBridgeReady', '');
                                document.attachEvent('onWeixinJSBridgeReady', '');
                            }
                        } else {
                        }
                    }

                </script>
       
            <script>
                function show_notice(content) {
                    if ($("#motify").length == 0) {
                        $("body").append('<div class="motify" id="motify"><div class="motify-inner" id="motify_content"></div></div>');
                    }
                    $("#motify").show();
                    $("#motify_content").html(content);
                    setTimeout(function() {
                        history.go(-1)
                       // $('#motify').hide();
                    }, 1000);
                }
            </script>
    </body>
</html>